package com.dcloud.manage.dbsource.controller;

import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dcloud.manage.request.SourceParamsChangeRequest;
import com.dcloud.manage.request.SourceParamsRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import com.dcloud.manage.service.entity.CollectSourceParam;
import com.dcloud.manage.service.ICollectSourceParamService;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;

import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;

 /**
 * @Description: 数据源参数表
 * @Author: jeecg-boot
 * @Date:   2022-09-07
 * @Version: V1.0
 */
@Api(tags="数据源参数表")
@RestController
@RequestMapping("/api/collectSourceParam/v1")
@Slf4j
public class CollectSourceParamController extends JeecgController<CollectSourceParam, ICollectSourceParamService> {
	@Autowired
	private ICollectSourceParamService collectSourceParamService;
	

	 /**
	  * 查询某个数据源的数据库配置
	  *
	  * @param sourceParamsRequest
	  * @return
	  */
	 @RequestMapping(value = "/getListBySourceId", method = RequestMethod.POST)
	 public Result<?> getListBySourceId(@RequestBody SourceParamsRequest sourceParamsRequest) {
		 return Result.OK(collectSourceParamService.getListBySourceId(sourceParamsRequest));
	 }

	 /**
	  * 修改数据源的参数
	  *
	  * @param sourceParamsRequest
	  * @return
	  */
	 @RequestMapping(value = "/changeParam", method = RequestMethod.POST)
	 public Result<?> getListBySourceId(@RequestBody SourceParamsChangeRequest sourceParamsRequest) {
		 return Result.OK(collectSourceParamService.changeParam(sourceParamsRequest));
	 }

}
